/*
 * @(#)XfdmProcess.java        2003/01/01
 *
 * This file is part of Xfuzzy 3.0, a design environment for fuzzy logic
 * based systems.
 *
 * (c) 2000 IMSE-CNM. The authors may be contacted by the email address:
 *                    xfuzzy-team@imse.cnm.es
 *
 * Xfuzzy is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation.
 *
 * Xfuzzy is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */

package xfuzzy.xfdm.model;

import xfuzzy.xfdm.view.Xfdm;

/**
 * Hilo del proceso de extracci�n de conocmiento
 * 
 * @author Francisco Jos� Moreno Velo
 *
 */
public class XfdmProcess extends Thread {

	//----------------------------------------------------------------------------//
	//                            MIEMBROS PRIVADOS                               //
	//----------------------------------------------------------------------------//

	/**
	 * Ventana principal de la aplicaci�n
	 */
	private Xfdm xfdm;

	/**
	 * Hilo de ejecuci�n del proceso de extracci�n de conocimiento
	 */
	private Thread thread;

	//----------------------------------------------------------------------------//
	//                               CONSTRUCTOR                                  //
	//----------------------------------------------------------------------------//

	/**
	 * Constructor
	 */
	public XfdmProcess(Xfdm xfdm) {
		super("xfdm thread 1");
		this.xfdm = xfdm;
		
		XfdmThread runnable = new XfdmThread(xfdm.getConfig());
		thread = new Thread(runnable,"xfdm thread 2");
		thread.start();

		start();
	}

	//----------------------------------------------------------------------------//
	//                             M�TODOS P�BLICOS                               //
	//----------------------------------------------------------------------------//

	/**
	 * Ejecuci�n del hilo
	 */
	public void run() {
		try { thread.join(); } 
		catch(Exception ex) { 
			xfdm.finish(""+ex); 
			return; 
		}
		
		xfdm.finish("Knowledge acquisition successfully finished");
	}
}
